// import { adminRequest } from '@/utils/request'
import {
  getAction,
  deleteAction,
  putAction,
  postAction,
  httpAction,
  postFormData
} from '@/api/manage'
const gateway = '/gateway/api'
import {
  axios
} from '@/utils/request'
const rightsApi = '/api/gateway/jic-usercenter-market-api-center/marketing/api'
const channelApi = '/gateway/api/admin/optionalChannel'
const api = {
  rightsList: rightsApi + '/list',
  rightsCreate: rightsApi + '/create',
  rightsDetail: rightsApi + '/detail',
  channelList: channelApi + '/list',
  channelCreate: channelApi + '/create',
  channelDetail: channelApi + '/createPageData',
  channelDelete: channelApi + '/delete',
  channelStartEnd: channelApi + '/startOrEnd',
  rightConfigList: '/gateway/api/admin/rightConfig/list'
}
export default api
// 会员权益
export function rightsList(parameter) {
  return axios({
    url: api.rightsList,
    method: 'post',
    data: parameter
  })
}
// 特权详情
export function rightsDetail(parameter) {
  return axios({
    url: api.rightsDetail,
    method: 'post',
    data: parameter
  })
}
// 特权创建&修改
export function rightsCreate(parameter) {
  return axios({
    url: api.rightsCreate,
    method: 'post',
    data: parameter
  })
}
// 获取权益配置
export function rightConfigList() {
  return axios({
    url: api.rightConfigList,
    method: 'get'
  })
}
// 自选频道列表
export function channelList(parameter) {
  return axios({
    url: api.channelList,
    method: 'post',
    data: parameter
  })
}
// 频道数据新增/修改
export function channelCreate(parameter) {
  return axios({
    url: api.channelCreate,
    method: 'post',
    data: parameter
  })
}
// 新增页面数据加载
export function channelDetail(parameter) {
  return axios({
    url: api.channelDetail + '/' + parameter,
    method: 'get'
  })
}
// 删除自选频道
export function channelDelete(parameter) {
  return axios({
    url: api.channelDelete + '/' + parameter,
    method: 'get'
  })
}
// 频道上下线
export function channelStartEnd(parameter) {
  return axios({
    url: api.channelStartEnd + '/' + parameter,
    method: 'get'
  })
}

// 订阅管理
let subscribe = '/admin/subscribe'
export const subscribeList = params => postAction(`${gateway}${subscribe}/subscribeList`, params) // 订阅列表 
export const subscribeDetails = params => postAction(`${gateway}${subscribe}/subscribeDetails`, params) // 订阅详情
export const unSubscribe = params => postAction(`${gateway}${subscribe}/unSubscribe`, params) // 退订
export const subscribeOrderList = params => postAction(`${gateway}${subscribe}/subscribeOrderList`, params) // 订阅订单
export const finishBill = params => postAction(`${gateway}${subscribe}/finishBill`, params) // 完结支付分订单
export const cancelBill = params => postAction(`${gateway}${subscribe}/cancelBill`, params) // 撤销支付分订单
export const beforeViewUnSubscribe = params => postAction(`${gateway}${subscribe}/beforeViewUnSubscribe`, params) // 退订前页面
export const getSubTypes = (params) => postAction(`${gateway}${subscribe}/getSubTypes`, params) // 获取订阅方式

export const advertList = (params) => postAction(gateway + '/admin/advert/list', params) // 广告位列表
export const advertCreateOrUpdate = (params) => postAction(gateway + '/admin/advert/createOrUpdate', params) // 创建广告位
export const advertDetail = (params) => postAction(gateway + '/admin/advert/detail', params) // 查询广告位


// 营销活动
let marketingActivity = gateway + '/admin/marketing/activity'
export const marketingActivityList = (params) => postAction(`${marketingActivity}/list`, params) // 活动列表
export const marketingActivityAdd = (params) => postAction(`${marketingActivity}/add`, params) // 活动新增
export const marketingActivityDelete = (params) => postAction(`${marketingActivity}/delete`, params) // 活动删除
export const marketingActivityDisable = (params) => postAction(`${marketingActivity}/disable`, params) // 活动下线
export const marketingActivityPickle = (params) => postAction(`${marketingActivity}/pickle`, params) // 活动投放

export const marketingActivityEdit = (params) => postAction(`${marketingActivity}/edit`, params) // 活动编辑
export const marketingActivityDetail = (params) => postAction(`${marketingActivity}/detail`, params) // 活动详情

export const marketingActivityDetaiList = (params) => postAction(`${marketingActivity}/detail/list`, params) // 活动明细列表
export const marketingActivityEditLogistics = (params) => postAction(`${marketingActivity}/edit/logistics`, params) // 活动编辑物流/收货地址
export const marketingActivityDownloadDetail = (params) => postAction(`${marketingActivity}/download/detail`, params) // 活动明细列表下载

// 经销
let reconciliation = '/gateway/api/admin/reconciliation'
export const querySettle = (params) => postAction(`${reconciliation}/querySettle`, params) // 获取经销物流对账列表
export const queryCStore = (params) => postAction(`${reconciliation}/queryCStore`, params) // 获取经销商
export const queryExpressType = (params) => postAction(`${reconciliation}/queryExpressType`, params) // 获取快递类型
export const importTable = (params) => postAction(`${reconciliation}/importTable`, params) // 导入表格
export const submitDebitNote = (params) => postAction(`${reconciliation}/submitDebitNote`, params) // 提交扣款单
export const updateFreight = (params) => postAction(`${reconciliation}/updateFreight`, params) // 导入表格

export const orderState = (params) => postAction(gateway + '/admin/orderState/list', params) // 异常订单列表

export const setBoxEbSalsList = (params) => postAction(gateway + '/openapi/salesPrivilege/setBoxEbSalsList', params)
export const delBoxEbSalsList = id => getAction(`/gateway/api/openapi/salesPrivilege/delBoxEbSalsList/${id}`)
export const queryBoxEbSalsList = id => getAction(`/gateway/api/openapi/salesPrivilege/queryBoxEbSalsList/${id}`)

export const setWriteCreateBoxGuide = (params) => postAction(gateway + '/openapi/salesPrivilege/setWriteCreateBoxGuide', params)
export const queryWriteCreateBoxGuide = id => getAction(`/gateway/api/openapi/salesPrivilege/queryWriteCreateBoxGuide/${id}`)
export const delWriteCreateBoxGuide = id => getAction(`/gateway/api/openapi/salesPrivilege/delWriteCreateBoxGuide/${id}`)